package com.sit.estatemanagementserver.dao;

// 重构: 该文件已根据最终实体类全面更新，以确保列名与实体属性一一对应。
public final class DatabaseContract {
    private DatabaseContract() {} // 防止实例化

    // 表: 业主 (Owner)
    public static class OwnerEntry {
        public static final String TABLE_NAME = "owners";
        public static final String COLUMN_PHONE = "phone"; // 主键
        public static final String COLUMN_PASSWORD = "password";
        public static final String COLUMN_USERNAME = "username"; // 对应实体类的 username
    }

    // 表: 房间 (Room)
    public static class RoomEntry {
        public static final String TABLE_NAME = "rooms";
        public static final String COLUMN_ROOM_NUMBER = "room_number"; // 主键
        public static final String COLUMN_WATER_BALANCE = "water_balance";
        public static final String COLUMN_ELECTRICITY_BALANCE = "electricity_balance";
        public static final String COLUMN_PROPERTY_FEE_BALANCE = "property_fee_balance";
        public static final String COLUMN_OWNER_PHONE_FK = "owner_phone"; // 外键 -> owners.phone
    }

    // 表: 图片 (Image)
    public static class ImageEntry {
        public static final String TABLE_NAME = "images";
        public static final String COLUMN_IMAGE_ID = "image_id"; // 主键
        public static final String COLUMN_IMAGE_PATH = "image_path";
    }

    // 表: 报修 (Repair)
    public static class RepairEntry {
        public static final String TABLE_NAME = "repairs";
        public static final String COLUMN_WORK_ORDER_ID = "work_order_id"; // 主键
        public static final String COLUMN_MESSAGE = "message";
        public static final String COLUMN_IMAGE_ID_FK = "image_id"; // 外键 -> images.image_id
        public static final String COLUMN_IS_HANDLED = "is_handled"; // 对应实体类的 isHandled
        public static final String COLUMN_ROOM_NUMBER_FK = "room_number"; // 外键 -> rooms.room_number
    }

    // 表: 投诉 (Complaint)
    public static class ComplaintEntry {
        public static final String TABLE_NAME = "complaints";
        public static final String COLUMN_WORK_ORDER_ID = "work_order_id"; // 主键
        public static final String COLUMN_MESSAGE = "message";
        public static final String COLUMN_IMAGE_ID_FK = "image_id"; // 外键 -> images.image_id
        public static final String COLUMN_OWNER_PHONE_FK = "owner_phone"; // 外键 -> owners.phone
    }

    // 表: 设施 (Facility)
    public static class FacilityEntry {
        public static final String TABLE_NAME = "facilities";
        public static final String COLUMN_FACILITY_ID = "facility_id"; // 主键
        public static final String COLUMN_FACILITY_NAME = "facility_name";
    }

    // 表: 设施租借 (FacilityRental)
    public static class FacilityRentalEntry {
        public static final String TABLE_NAME = "facility_rentals";
        public static final String COLUMN_WORK_ORDER_ID = "work_order_id"; // 主键
        public static final String COLUMN_FACILITY_ID_FK = "facility_id"; // 外键
        public static final String COLUMN_OWNER_PHONE_FK = "owner_phone"; // 外键
        public static final String COLUMN_RENTAL_INFO = "rental_info";
        public static final String COLUMN_START_TIME = "start_time"; // 对应实体类的 startTime
        public static final String COLUMN_END_TIME = "end_time"; // 对应实体类的 endTime
    }

    // 表: 拜访信息 (VisitInfo)
    public static class VisitInfoEntry {
        public static final String TABLE_NAME = "visit_info";
        public static final String COLUMN_VISITOR_ID = "visitor_id";
        public static final String COLUMN_VISITOR_NAME = "visitor_name";
        public static final String COLUMN_VISITOR_PHONE = "visitor_phone";
        public static final String COLUMN_ROOM_NUMBER_FK = "visiting_room_number";
        public static final String COLUMN_VISIT_PURPOSE = "visit_purpose";
        public static final String COLUMN_VISIT_START_TIME = "visit_start_time";
        public static final String COLUMN_VISIT_END_TIME = "visit_end_time";
        // public static final String COLUMN_QR_CODE_ID_FK = "qr_code_id"; // 删除或注释掉此行
        public static final String COLUMN_QR_PAYLOAD = "qr_code_payload"; // 新增此行
    }
}